﻿using System.Collections.Generic;
using System.Linq;

namespace MISTBowl_Brackets
{
	public static class MatchAnalysis
	{
		public static int RepeatMatchCount(this List<Team> match)
		{
			return Combinations.GetAllCombinations(match, 2).Sum(a => Matches.GetMatchCount(a[0], a[1]));
		}

		public static int SameRegionMatchCount(this List<Team> match)
		{
			return Combinations.GetAllCombinations(match, 2).Count(a => a[0].region == a[1].region);
		}

		public static int RepeatRegionMatchCount(this List<Team> match, List<Team> teamList)
		{
			return Combinations.GetAllCombinations(match, 2).Sum(a => teamList.Where(b => b.region == a[1].region).Sum(b => Matches.GetMatchCount(a[0], b)) + teamList.Where(b => b.region == a[0].region).Sum(b => Matches.GetMatchCount(a[1], b)));
		}
	}
}